*********** Replication code for Sabina Avdagic and Lee Savage (2024) "Does the framing of immigration induce welfare chauvinism? The effects of negativity bias and motivated reasoning" published in Political Behavior  ************

*** Use replication_data.dta ***

** Variable list **

imm_access (dependent variable - The government should guarantee that immigrants have the same rights to social benefits as German citizens: 1. Strongly disagree, 2. Disagree, 3. Neither agree nor disagree, 4. Agree, 5. Strongly agree)
treatment_group (1=negative frame, 2=positive frame, 3=control group)
scale (ideological self-placement, 1=most left-wing, 7=most right-wing)
virtual_btw_13_quote (party voted for at last election)
high_hincome_v2 (high income here is a dummy with the cut off point of £4,500 for the net monthly household income)
job (How confident are you that you will keep your current job for the next 12 months?)
pro (How do you think the financial situation of your household will change in the next 12 months?)
soc_grade (Social grade: 1=Higher technical, 2=Manager/senior administrator, 3=Junior management, 4=Sales/service sector, 5=Foreman/supervisor, 6=Skilled manual, 7=Semi-skilled/unskilled, 8= Miscellaneous, 9=Never been employed)
z_geschlecht (gender)
z_age_omnibus_18 (age)
hinc (income)
work_stat (work status)
educ_neu (level of education)
w8 (weight variable)


*************************************************************************************************************************
* Main models - Table A3*
*************************************************************************************************************************

reg imm_access ib3.treatment_group [pweight = w8]
est store reg1
reg imm_access ib3.treatment_group##c.scale [pweight = w8]
est store reg2
reg imm_access ib3.treatment_group##virtual_btw_13_quote [pweight = w8]
est store reg3

******* Figure 1 ***
reg imm_access ib3.treatment_group [pweight = w8]
margins, dydx(treatment_group)
marginsplot, ciopt(color(black%20)) legend(ring(0))

****** Figure 2 *****
reg imm_access ib3.treatment_group##virtual_btw_13_quote [pweight = w8]
margins, dydx(treatment_group) at(virtual_btw_13_quote=(1(1)8)) 
marginsplot, recast(scatter) ciopt(color(black%20)) legend(pos(7) ring(0))

*** Figure 3 ***
reg imm_access ib3.treatment_group##c.scale [pweight = w8]
margins, dydx(treatment_group) at(scale=(1(1)7)) 
marginsplot, recast(line) ciopt(color(black%20)) recastci(rarea) legend(pos(7) ring(0))


*********** Tabl A5**************

reg imm_access ib3.treatment_group##c.scale ib3.treatment_group##high_hincome_v2 [pweight = w8]
* high income here is a dummy with the cut off point of £4,500 for the net household income.

reg imm_access ib3.treatment_group##c.scale ib3.treatment_group##job [pweight = w8]

reg imm_access ib3.treatment_group##c.scale ib3.treatment_group##pro [pweight = w8]

reg imm_access  ib3.treatment_group##c.scale ib3.treatment_group##soc_grade [pweight = w8]


******* Figure 4 (A) ***********
reg imm_access ib3.treatment_group##c.scale ib3.treatment_group##high_hincome_v2 [pweight = w8]
margins, dydx(treatment_group) at(high_hincome_v2=(0 1)) 
marginsplot, recast(scatter) ciopt(color(black%20)) legend(pos(6) ring(0))

******* Figure 4 (B) ***********
reg imm_access  ib3.treatment_group##c.scale ib3.treatment_group##soc_grade [pweight = w8]
margins, dydx(treatment_group) at(soc_grade=(1(1)9)) 
marginsplot, recast(scatter) ciopt(color(black%20)) legend(pos(7) ring(0))

******* Figure 4 (C) ***********
reg imm_access ib3.treatment_group##c.scale ib3.treatment_group##job [pweight = w8]
margins, dydx(treatment_group) at(job=(1(1)5)) 
marginsplot, recast(scatter) ciopt(color(black%20)) legend(pos(7) ring(0))

******* Figure 4 (D) ***********
reg imm_access ib3.treatment_group##c.scale ib3.treatment_group##pro [pweight = w8]
margins, dydx(treatment_group) at(pro=(1(1)5)) 
marginsplot, recast(scatter) ciopt(color(black%20)) legend(pos(7) ring(0))


**** Figure A1 ****
clonevar ideology_terciles = scale
recode ideology_terciles (1/2=1) (3/5=2) (6/7=3)

reg imm_access ib3.treatment_group##i.ideology_terciles [pweight = w8]

margins, dydx(treatment_group) at(ideology_terciles=(1(1)3)) 
marginsplot, recast(scatter) legend(pos(7) ring(0))


***** Table A2 *******

mlogit treatment_group i.z_geschlecht i.z_age_omnibus_18 i.hinc i.virtual_btw_13_quote i.work_stat i.job i.educ_neu [pweight = w8], b(3)


******* Table A4 ******

ologit imm_access ib3.treatment_group [pweight = w8]
est store reg1
ologit imm_access ib3.treatment_group##c.scale [pweight = w8]
est store reg2
ologit imm_access ib3.treatment_group##virtual_btw_13_quote [pweight = w8]
est store reg3
